<!--#include file="admin/Includes/constants.asp"-->
<!--#include file="admin/Includes/validate.asp"-->
<%
SSLMode = 1

MakeSSL 1
Dim Action, loginemail, pass, fname, lname, title, userid
Dim strMes, result, hideform
Dim i, aData , hasData, nRows
dim usertype, career
Dim Destination, strQuery
Dim ref

Destination = Request("d")
strQuery = Request("qs")
ref = "d=" & Server.URlEncode(Destination) & "&qs=" & Server.UrlEncode(strQuery)


Action = request("act")
if Action <> "" then
	loginemail = getData("rqloginemail_em")
	pass = getData("rqpass")	
	Title = getData("title")
	fname = getData("rqfname")
	lname = getData("rqlname")
	userid = getData("userid")
	usertype = getData("usertype")
	career = getData("career")	

	'handle hacker
	if usertype <> "5" and usertype <> "4" then usertype = 5 ' default for reader	
	
	strSQL = "{CALL a_reg ('"& ckid & "','" & loginemail & "','" & pass & "','" & Title & "',N'" & fname & "',N'" & lname & "',0,'" & usertype & "','" & career &"')}"
	'response.Write(strsql)
'	response.End()
	exec(strsql)
	result = RS(0)
	if result = 1 then
		strMes = "Đăng ký hoàn tất<br>"	
		hideform = true
	elseif result = 2 then
		strMes = "Sửa đổi thông tin hòan tất<br>"		
		hideform = true
	else
		if userid <> "" then
			strMes ="Không thể sửa đổi vì e-mail <strong>"&loginemail&"</strong> đã đang được sử dụng"
		else
			strMes ="Không thể đăng ký vì e-mail <strong>"&loginemail&"</strong> đã được đăng ký"			
		end if
	end if
end if

'get list user career 
	strSQL = "{CALL a_usercareer_sel }"
'	response.Write(strsql)
'	response.End()
	exec(strsql)
	
	if not RS.EOF then 
		aData = RS.getrows
		nRows = UBound(aData,2)
		hasData = true
	End if
'Close connection
CloseCon

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<Meta http-equiv="Content-Type" content="text/html; charset=utf-8">
	<title>Thoi Trang-thoitrang</title>
	<Meta name="keywords" content="thoi trang, thoitrang, thoi trang tre, thoi trang viet nam"> 
	<Meta name="description" content="Tap chi truc tuyen thoi trang viet nam thoitrang.com">
	<Meta http-equiv=" content-language" content ="en-us">
	<Meta name="Robots" content="noindex,nofollow">
	<link rel="shortcut icon" href="favicon.ico" type="image/x-icon"> 
	<link rel="icon" href="favicon.ico" type="image/x-icon"> 
	<link rel="STYLESHEET" type="text/css" href="system/styles.css">
    <script language="JavaScript" type="text/javascript" src="system/MM_rollover.js"></script>	
	<script language="javascript" src="admin/javascripts/validateVN.js"></script>
	<script language="JavaScript" type="text/javascript" src="admin/javascripts/handler.js"></script>		
	<script>
		function validate(frm)
		{
			if (isValid(frm) ==false) return false;
			if (frm.rqpass.value != frm.rqconfirmpass.value)
			{
				frm.rqpass.value = ""
				frm.rqconfirmpass.value = ""
				return errorFound(frm.rqpass, "Mật mã và xác nhận mật mã phải giống nhau");
			}
			return true;
		}
		function handleUserType()
		{
			displayObj('cat', document.frm.usertype.value == 5 ? 0 : 1);
		}
	</script>		
</head>
<body  <%if hideform = false then %>onLoad="document.frm.rqloginemail_em.focus();handleUserType()" <%end if%> >
<div id="container">
<div id="bt2"><img src="hinh-thoi-trang/bg_top.gif" width="1049" height="20"></div>
<div id="container">
<table border="0" cellpadding="0" cellspacing="0" width="990" align="center">	
	<!--top-->
	<!--#include file="system/top.asp" -->
	<!--/top-->
	<tr bgcolor="#6b5a60">
		<td width="160" style="height:1px;"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td>
		<td width="522" valign="top" rowspan="2">		
		<!--body content-->		
			<!--cover-->		
		<table border="0" cellpadding="0" cellspacing="1" width="100%" bgcolor="#B6A8AD">			
			<tr><td colspan="3" style="padding-left:12px; "><img src="hinh-thoi-trang/dang-ky-thanh-vien-hp.gif" width="400" height="40"></td></tr>
			<tr>
				<!--col left-->		
				<td valign="top" height=680>
					<table cellpadding="0" cellspacing="0" border="0" bgcolor="#FFFFFF" width=100%>
						<tr>
							<td style="padding-left:9px;padding-top:15px" height="100%" valign=top>							
								<% if strMes <> "" then%>
								<P class="paging"><%=strMes%></P>
							<%end if%>
							<%if hideform = false then%>
							<form name ="frm" action="reg.asp?ckid=<%=ckid%>" method="post" onSubmit="return validate(this)">
							<input name="d" type="hidden" value="<%= Destination%>">
							<input name="qs" type="hidden" value="<%= strQuery%>">		
								<table border="0" cellpadding="3" cellspacing="0">
									<tr>
										<td class="paging" nowrap>E-mail đăng nhập:</td>
										<td><input type="text" id="E-mail đăng nhập" name="rqloginemail_em" value="<%=loginemail%>" style="width:200px" class="txtInput"></td>
									    <td rowspan="7"><span id="siteseal"><script language="Javascript" src="https://seal.godaddy.com/getSeal?sealID=56236410308d11cc812711877411eac17f2c098055460"></script></span></td>
									</tr>
									<tr>
										<td class="paging">Mật mã:</td>
										<td><input type="password" id="Mật mã" name="rqpass" style="width:200px" class="txtInput"></td>
									</tr>						
									<tr>
										<td class="paging">Xác nhận mật mã:</td>
										<td><input type="password" name="rqconfirmpass" id="Xác nhận mật mã" style="width:200px" class="txtInput"></td>
									</tr>												
									<tr>
										<td class="paging">Giới tính:</td>
										<td>
										<select name="Title" style="width:200px" class="txtInput" id="Giới tính">
											<option value="M" <% If Title = "M" Then %> Selected <% End If %>>Nam</option>
											<option value="F" <% If Title = "F" Then %> Selected <% End If %>>Nữ</option>
										</select>	
										</td>
									</tr>												
									<tr>
										<td class="paging">Tên:</td>
										<td><input type="text" id="Tên" name="rqfname" value="<%=fname%>" style="width:200px" class="txtInput"></td>
									</tr>						
									<tr>
										<td class="paging">Họ:</td>
										<td><input type="text" id ="Họ" name="rqlname" value="<%=lname%>" style="width:200px" class="txtInput"></td>
									</tr>				
									<tr>
										<td class="paging">Loại thành viên:</td>
										<td><select name="usertype" style="width:200px" class="txtInput" id="Loại thành viên" onChange="handleUserType()">
											<%for i=0 to ubound(arUserType) %>
											<option value="<%=arUserTypeID(i)%>" <% If cint(usertype) = arUserTypeID(i) Then %> Selected <% End If %> ><%= arUserType(i)%></option>
											<%next%>
										</select>	
										</td>
									</tr>	
									<tr>
										<td colspan=2 style="padding: 0 0 0 0">											
										<table border=0 cellpadding=3 cellspacing=0 id="cat" style="display:none">
											<tr>
												<td class="paging" width=108>Ngành nghề:</td>
												<td><select name="career" style="width:200px" class="txtInput" id="Ngành nghề">
													<option value="" <% If career = "" Then %> Selected <% End If %> >Khác</option>												
													<%
													if hasData then
													for i=0 to nRows  %>
													<option value="<%=aData(0,i)%>" <% If strcomp(career, aData(0,i)) = 0 Then %> Selected <% End If %> ><%=aData(1,i)%></option>
													<%next
													end if
													%>
												</select>
												</td>
											</tr>								
										</table>																		
										</td>
									</tr>																										
									<tr>
										<td>&nbsp;</td>
										<td><input type="submit" name="act" value="ĐĂNG KÝ" class="btnGo"></td>
									</tr>
									</form>
								</table>						
							<%else%>
							<a href="login.asp?ckid=<%=ckid%>&<%=ref%>"><img src="hinh-thoi-trang/btn_continue.gif" border="0"></a>
							<%end if%>											
							</td>
						</tr>
						<tr><td><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="15" border="0"></td></tr>
						<tr><td bgcolor="#B6A8AD"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td></tr>
						<tr><td><h5 style="padding-left:12px;padding-right:15px;padding-top:10px;display:block;"><strong>Chính sách NO-SPAM </strong><br>
						ThoiTrang.com thiết lập một chính sách NO-SPAM (hoàn toàn không có thư rác) 
						đối với email của các bạn và tuyệt đối không cung cấp cho một bên thứ ba. Email của các bạn chỉ dùng để liên lạc các vấn 
						đề hoặc thông tin thời trang mà bạn yêu cầu. Bạn có thể xem <a href="privacypolicy.asp?ckid=<%=ckid%>" class="link" style="text-decoration:underline;">Chính sách bảo mật</a> của chúng tôi để
						biết thêm chi tiết.
						</h5></td></tr>
					</table>						 
				</td>
				<!--/col left-->							
			</tr>
		</table>
			<!--/text-->		
		<!--/body content-->
		</td>
		<td width="308" style="width:0px;"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td>
	</tr>
	<!--main body-->
	<tr bgcolor="#ffffff">
		<td bgcolor="#000000" width="160" valign="top">
		<!--#include file="system/left.asp" -->
		</td>
		<!--missing 1 TD because of Rowspan-->		
		<td bgcolor="#614B00" width="308" valign="top">
			<table border="0" cellpadding="0" cellspacing="0" width="308" align="right">
				<tr bgcolor="#000000"><td colspan="2"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td></tr>
				<form action="listing.asp?ckid=<%=ckid%>" method="post">
				<tr bgcolor="#8D0045">
					<td width="154" valign="top" height="33" ><input type="text" name="search" value="Tìm kiếm" size="22" class="txtSearch"></td>
					<td width="154" valign="top" style="padding-top:7px;padding-left:3px;"><input type="submit" name="go" value="TÌM" class="btnGo"></td>
				</tr>
				</form>
				<tr bgcolor="#000000"><td colspan="2"><img src="hinh-thoi-trang/de_clear.gif" alt="" width="1" height="1" border="0"></td></tr>
				<!--Ads Starts-->
				<tr><td align="center" colspan="2"><img src="hinh-quang-cao/neimanmarcus350x250.jpg" alt="" width="300" height="250" border="0"></td></tr>
				<!--Ads Ends-->
			</table>
		</td>
	</tr>
	<!--/main body-->
	<!--#include file="system/bottom.asp" -->
</table>
</div>
<div id="bt2"><img src="hinh-thoi-trang/bg_bottom.gif" width="1049" height="20"></div>
</div>
</body>
</html>
